<template>
  <div id="user_recharge" class="">
    <boxconfirm content_title="请到电脑端充值" content_confirm="确定" content_cancel="取消" @confirmClick="goMember" ref="bboxconfirm"></boxconfirm>
    <div>   
      <k-header headTitle="账户充值" goBack="true" />
    </div>
    <div class="recharlist" :class="headIos?'side-fixd-ios':'side-fixed'">
      <group class="grou">       
        <cell title="当前账户余额" :value="balance"></cell>       
        <cell title="充值金额" disabled ></cell>
      </group>
       <div class="cash">
        <input type="text" placeholder="请输入金额" v-model="pricea" />
      </div>      
      <!-- <group class="jeep">
        <cell title="充值方式" disabled></cell>        
        <cell title="支付宝" is-link />
      </group> -->
      <!-- <div class="checkf">
        <check-icon :value.sync="de">需要发票</check-icon>
        <a href="#" class="jiubei">查看发票信息</a>
        <router-link to="/userFill" class="jiubei">查看发票信息</router-link>
      </div> -->
    </div>
    <div class="charbt" @click="recharge()">充值</div>
    <!-- <div class="charbt" @click="newrecharge()">充值</div> -->
  </div>
</template>

<script>
import kHeader from '../common/head'
import { Cell, Group, CheckIcon } from 'vux'
import util from '../../libs/util'
import boxconfirm from '../common/boxconfirm';
export default {
  name: 'userrecharge',
  data () {
    return {
      de: false,
      pricea: '',
      balance: '￥100元',
      headIos: false
    }
  },
  components: {
    kHeader,
    Cell,
    Group,
    CheckIcon,
    boxconfirm
  },
  methods: {
    recharge() {
        var that = this;
        console.log(123456);
        var url = 'lblsapp-h5/v2/order/rechargesub.json';
        let gej = {};
        if( that.pricea>=0 && that.pricea<=10000 ){ //判断永辉充值金额验证
          gej.price = that.pricea;
          gej.type = 0;
          console.log(gej);
          util.ajax.post(url,gej).then(function(stats) {
            var interfaces = stats.data.res.data;
            that.$router.push({ path: '/newPay', query: { donot: interfaces.outTradeNo } });
            // window.location.href = 'http://wx.innjia.com/h5v2/shouyintai/yuxiaoerpay/WEB-INF/views/default/checkstand164.html?outTradeNo='+ ;
          }).catch(function(error) {
            console.log(error)
          })
        }
    },
    getbalance() {
      var that =this;
      let url = '/lblsapp-h5/v2/personCenter/personCenterIndex.json';
      util.ajax.post(url).then(function(stats){
        that.balance = "￥" + stats.data.res.data.totalAmount + '元';
      }).catch(function(error){
        console.log(error);
      })
    },
    newrecharge() {
      this.$refs.bboxconfirm.show();
    },
    goMember(){}
  },
  created() {
    if (window.navigator.userAgent.indexOf('LBLSIOS') > -1) {
      this.headIos = true;
    }
    this.getbalance();
  }
}
</script>

<style scoped>
  .jiubei {
    color: #F89721;
    margin-left: 1.2rem;
    position: relative;
    top: 1px;
  }
  .vux-check-icon>span{
      color: #808080 !important;
  }
  .recharlist {
    position: fixed;
    width: 100%;
    top: 45px;
    left: 0;
    bottom: 0;
  }
  .side-fixd-ios {
    padding: 65px 0 0 0;
  }
  .weui-cell {
    padding: 10px !important;
    font-size: 14px;
  }
  .weui-cell:before, .weui-cells:before{
    border-top: none;
  }
  .weui-cells:after {
    border-bottom: none;
  }
  .vux-cell-disabled {
    background: #f5f5f5;
  }
  .cash {
    width: 100%;
    height: 45px;
    /* padding: 15px; */
    background-color: #fff;
  }
  
  .cash input {
    box-sizing: border-box;
    width: 100%;
    height: 44px;
    border: none;
    padding: 0 0 0 1.2rem;
    outline:none;
    color: #F89721;
  }
  .jeep .weui-cells{
    margin-top: 0;
  }
  .weui-icon-success { 
    color: #F89721 !important;
  }

  .vux-check-icon>.weui-icon-success:before,
  .vux-check-icon>.weui-icon-success-circle:before{
    color: #F89721 !important;
  }
  .checkf {
    margin: 20px 0 0 0;
    padding: 0 0 0 .4rem;
  }
  .weui-icon-circle {
    font-size: 19px !important;
  }
  .charbt {
    position: fixed;
    width: 100%;
    height: 44px;
    bottom: 0;
    left: 0;
    line-height: 44px;
    text-align: center;
    color: #fff;
    background-color: #F89721;
    font-size: 16px;
  }
</style>


